import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    component: () => import('@/views/Login')
  },
  {
    path: '/home',
    component: () => import('@/views/Home'),
    redirect: '/we',
    meta: { auth: true },
    children: [
      {
        path: '/users',
        component: () => import('@/views/Users')
      },
      {
        path: '/we',
        component: () => import('@/views/We'),
      },
      {
        path: '/roles',
        component: () => import('@/views/Roles/roles'),
      },
      {
        path: '/rights',
        component: () => import('@/views/Roles/rights'),
      },
      {
        path: '/goods',
        component: () => import('@/views/Goods/goods'),
      },
      {
        path: '/goodsAdd',
        component: () => import('@/views/Goods/goodsAdd'),
      },
      {
        path: '/orders',
        component: () => import('@/views/Orders'),
      },
      {
        path: '/categories',
        component: () => import('@/views/Goods/categories'),
      },
      {
        path: '/params',
        component: () => import('@/views/Goods/params'),
      },
      {
        path: '/reports',
        component: () => import('@/views/Reports'),
      },
    ]
  }

]

const router = new VueRouter({
  routes
})

export default router
